<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../bootstrap/bootstrap.min.css">
</head>

<body>
    <button class="btn btn-primary btn-lg" id="btn">
        开始演示模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="myModalLabel">
                        模态框（Modal）标题
                    </h4>
                </div>
                <div class="modal-body">
                    在这里添加一些文本
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default">关闭
                    </button>
                    <button type="button" class="btn btn-primary">
                        提交更改
                    </button>
                </div>
            </div><!-- /.modal-content -->

        </div><!-- /.modal -->
    </div>

    <script src="../bootstrap/bootstrap.min.js"></script>
    <script>
        const mymodal = new bootstrap.Modal(document.querySelector("#myModal"));
        document.querySelector("#btn").addEventListener("click", function () {
            // console.log(111);
            // $("#myModal").modal("show")
            mymodal.show();
        })

        document.querySelector(".btn-default").onclick = () => mymodal.hide();
    </script>
</body>

</html>